from django.shortcuts import render

# Create your views here.
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from .models import ImageSave
from .serializers import ImageSaveSerializer
from django.core.files.storage import FileSystemStorage
import os

class ImageSaveView(APIView):
    def post(self, request):
        serializer = ImageSaveSerializer(data=request.data)
        if serializer.is_valid():
            serializer.save()
            return Response({'code': 1, 'data': serializer.data}, status=status.HTTP_201_CREATED)
        return Response({'code': 0, 'msg': serializer.errors}, status=status.HTTP_400_BAD_REQUEST)
